```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Spring框架中的设计模式解析</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            color: #333;
            line-height: 1.6;
        }
        .hero-gradient {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        .pattern-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
        }
        .hover-grow {
            transition: transform 0.3s ease;
        }
        .hover-grow:hover {
            transform: scale(1.03);
        }
        .section-title {
            position: relative;
            display: inline-block;
        }
        .section-title:after {
            content: '';
            position: absolute;
            bottom: -8px;
            left: 0;
            width: 50px;
            height: 3px;
            background: #667eea;
        }
        .pattern-icon {
            font-size: 2.5rem;
            color: #667eea;
            margin-bottom: 1rem;
        }
        .mermaid-container {
            background: #f8fafc;
            border-radius: 0.5rem;
            padding: 2rem;
            margin: 2rem 0;
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
        }
    </style>
</head>
<body>
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20 px-4">
        <div class="container mx-auto max-w-5xl">
            <div class="flex flex-col items-center text-center">
                <h1 class="text-4xl md:text-5xl font-bold mb-6 font-serif">Spring框架中的设计模式</h1>
                <p class="text-xl md:text-2xl max-w-3xl mb-8 opacity-90">探索Spring框架背后的12种经典设计模式如何构建强大架构</p>
                <div class="flex space-x-4">
                    <a href="#patterns" class="bg-white text-indigo-600 hover:bg-gray-100 px-6 py-3 rounded-lg font-medium transition duration-300 hover-grow">探索模式</a>
                    <a href="#visualization" class="border-2 border-white text-white hover:bg-white hover:text-indigo-600 px-6 py-3 rounded-lg font-medium transition duration-300 hover-grow">查看图表</a>
                </div>
            </div>
        </div>
    </section>

    <!-- Introduction -->
    <section class="py-16 px-4 bg-gray-50">
        <div class="container mx-auto max-w-5xl">
            <div class="text-center mb-12">
                <h2 class="text-3xl font-bold mb-4 section-title">设计模式：Spring框架的灵魂</h2>
                <p class="text-lg text-gray-600 max-w-3xl mx-auto">
                    Spring框架巧妙运用多种设计模式，构建了松耦合、可扩展且易于维护的系统架构。
                    这些模式不仅提升了框架的灵活性，也为开发者提供了优雅的编程范式。
                </p>
            </div>
            <div class="grid md:grid-cols-3 gap-8">
                <div class="bg-white p-6 rounded-lg shadow-md hover:shadow-lg transition duration-300">
                    <i class="fas fa-cubes text-3xl text-indigo-500 mb-4"></i>
                    <h3 class="text-xl font-semibold mb-3">架构解耦</h3>
                    <p class="text-gray-600">通过代理、工厂等模式实现组件间低耦合</p>
                </div>
                <div class="bg-white p-6 rounded-lg shadow-md hover:shadow-lg transition duration-300">
                    <i class="fas fa-expand-arrows-alt text-3xl text-indigo-500 mb-4"></i>
                    <h3 class="text-xl font-semibold mb-3">灵活扩展</h3>
                    <p class="text-gray-600">策略、模板方法等模式支持系统无缝扩展</p>
                </div>
                <div class="bg-white p-6 rounded-lg shadow-md hover:shadow-lg transition duration-300">
                    <i class="fas fa-cogs text-3xl text-indigo-500 mb-4"></i>
                    <h3 class="text-xl font-semibold mb-3">高效维护</h3>
                    <p class="text-gray-600">统一的设计模式应用提升代码可读性和可维护性</p>
                </div>
            </div>
        </div>
    </section>

    <!-- Patterns Section -->
    <section id="patterns" class="py-16 px-4">
        <div class="container mx-auto max-w-5xl">
            <h2 class="text-3xl font-bold mb-12 text-center section-title">12种核心设计模式解析</h2>
            
            <div class="grid md:grid-cols-2 gap-8">
                <!-- 单例模式 -->
                <div class="pattern-card bg-white rounded-lg overflow-hidden shadow-md transition duration-300">
                    <div class="p-6">
                        <div class="pattern-icon">
                            <i class="fas fa-crown"></i>
                        </div>
                        <h3 class="text-2xl font-bold mb-3 text-indigo-600">1. 单例模式 (Singleton)</h3>
                        <p class="text-gray-600 mb-4"><strong>定义：</strong>确保一个类只有一个实例，并提供全局访问点。</p>
                        <div class="bg-indigo-50 p-4 rounded-lg">
                            <p class="text-indigo-700"><strong>Spring应用：</strong>Spring默认将Bean的作用域设置为单例，容器启动时创建一个Bean实例并在整个应用中重用。</p>
                        </div>
                    </div>
                </div>

                <!-- 工厂方法模式 -->
                <div class="pattern-card bg-white rounded-lg overflow-hidden shadow-md transition duration-300">
                    <div class="p-6">
                        <div class="pattern-icon">
                            <i class="fas fa-industry"></i>
                        </div>
                        <h3 class="text-2xl font-bold mb-3 text-indigo-600">2. 工厂方法模式 (Factory Method)</h3>
                        <p class="text-gray-600 mb-4"><strong>定义：</strong>定义创建对象的接口，让子类决定实例化哪个类。</p>
                        <div class="bg-indigo-50 p-4 rounded-lg">
                            <p class="text-indigo-700"><strong>Spring应用：</strong>BeanFactory和ApplicationContext接口提供创建和管理Bean的方法，具体实现决定如何实例化Bean。</p>
                        </div>
                    </div>
                </div>

                <!-- 抽象工厂模式 -->
                <div class="pattern-card bg-white rounded-lg overflow-hidden shadow-md transition duration-300">
                    <div class="p-6">
                        <div class="pattern-icon">
                            <i class="fas fa-factory"></i>
                        </div>
                        <h3 class="text-2xl font-bold mb-3 text-indigo-600">3. 抽象工厂模式 (Abstract Factory)</h3>
                        <p class="text-gray-600 mb-4"><strong>定义：</strong>提供接口用于创建一系列相关或依赖的对象。</p>
                        <div class="bg-indigo-50 p-4 rounded-lg">
                            <p class="text-indigo-700"><strong>Spring应用：</strong>ApplicationContext可以创建多个Bean及它们的相关对象，体现了抽象工厂思想。</p>
                        </div>
                    </div>
                </div>

                <!-- 建造者模式 -->
                <div class="pattern-card bg-white rounded-lg overflow-hidden shadow-md transition duration-300">
                    <div class="p-6">
                        <div class="pattern-icon">
                            <i class="fas fa-hammer"></i>
                        </div>
                        <h3 class="text-2xl font-bold mb-3 text-indigo-600">4. 建造者模式 (Builder)</h3>
                        <p class="text-gray-600 mb-4"><strong>定义：</strong>将复杂对象的构建与其表示分离，同样的构建过程可创建不同表示。</p>
                        <div class="bg-indigo-50 p-4 rounded-lg">
                            <p class="text-indigo-700"><strong>Spring应用：</strong>BeanDefinitionBuilder用于逐步构建BeanDefinition对象，配置Bean属性和初始化方法。</p>
                        </div>
                    </div>
                </div>

                <!-- 代理模式 -->
                <div class="pattern-card bg-white rounded-lg overflow-hidden shadow-md transition duration-300">
                    <div class="p-6">
                        <div class="pattern-icon">
                            <i class="fas fa-user-secret"></i>
                        </div>
                        <h3 class="text-2xl font-bold mb-3 text-indigo-600">5. 代理模式 (Proxy)</h3>
                        <p class="text-gray-600 mb-4"><strong>定义：</strong>为其他对象提供代理以控制对这个对象的访问。</p>
                        <div class="bg-indigo-50 p-4 rounded-lg">
                            <p class="text-indigo-700">
                                <strong>Spring应用：</strong><br>
                                1. AOP使用代理模式为目标对象提供增强功能(JDK动态代理和CGLIB代理)<br>
                                2. 事务管理通过代理模式在方法调用前后添加事务处理逻辑
                            </p>
                        </div>
                    </div>
                </div>

                <!-- 观察者模式 -->
                <div class="pattern-card bg-white rounded-lg overflow-hidden shadow-md transition duration-300">
                    <div class="p-6">
                        <div class="pattern-icon">
                            <i class="fas fa-bell"></i>
                        </div>
                        <h3 class="text-2xl font-bold mb-3 text-indigo-600">6. 观察者模式 (Observer)</h3>
                        <p class="text-gray-600 mb-4"><strong>定义：</strong>对象间一对多依赖关系，状态变化自动通知依赖对象。</p>
                        <div class="bg-indigo-50 p-4 rounded-lg">
                            <p class="text-indigo-700"><strong>Spring应用：</strong>事件机制(ApplicationEvent和ApplicationListener)允许在事件发生时通知其他组件。</p>
                        </div>
                    </div>
                </div>

                <!-- 模板方法模式 -->
                <div class="pattern-card bg-white rounded-lg overflow-hidden shadow-md transition duration-300">
                    <div class="p-6">
                        <div class="pattern-icon">
                            <i class="fas fa-project-diagram"></i>
                        </div>
                        <h3 class="text-2xl font-bold mb-3 text-indigo-600">7. 模板方法模式 (Template Method)</h3>
                        <p class="text-gray-600 mb-4"><strong>定义：</strong>定义算法骨架，将一些步骤延迟到子类中。</p>
                        <div class="bg-indigo-50 p-4 rounded-lg">
                            <p class="text-indigo-700"><strong>Spring应用：</strong>JdbcTemplate和HibernateTemplate定义执行数据库操作的骨架，具体操作由钩子方法实现。</p>
                        </div>
                    </div>
                </div>

                <!-- 策略模式 -->
                <div class="pattern-card bg-white rounded-lg overflow-hidden shadow-md transition duration-300">
                    <div class="p-6">
                        <div class="pattern-icon">
                            <i class="fas fa-chess-knight"></i>
                        </div>
                        <h3 class="text-2xl font-bold mb-3 text-indigo-600">8. 策略模式 (Strategy)</h3>
                        <p class="text-gray-600 mb-4"><strong>定义：</strong>定义一系列算法，封装并使它们可互换。</p>
                        <div class="bg-indigo-50 p-4 rounded-lg">
                            <p class="text-indigo-700"><strong>Spring应用：</strong>HandlerMapping和ViewResolver接口允许Spring根据不同策略处理请求和解析视图。</p>
                        </div>
                    </div>
                </div>

                <!-- 装饰者模式 -->
                <div class="pattern-card bg-white rounded-lg overflow-hidden shadow-md transition duration-300">
                    <div class="p-6">
                        <div class="pattern-icon">
                            <i class="fas fa-paint-roller"></i>
                        </div>
                        <h3 class="text-2xl font-bold mb-3 text-indigo-600">9. 装饰者模式 (Decorator)</h3>
                        <p class="text-gray-600 mb-4"><strong>定义：</strong>动态给对象添加额外职责。</p>
                        <div class="bg-indigo-50 p-4 rounded-lg">
                            <p class="text-indigo-700"><strong>Spring应用：</strong>Filter和Interceptor可在不修改原有代码情况下对请求和响应进行装饰处理。</p>
                        </div>
                    </div>
                </div>

                <!-- 适配器模式 -->
                <div class="pattern-card bg-white rounded-lg overflow-hidden shadow-md transition duration-300">
                    <div class="p-6">
                        <div class="pattern-icon">
                            <i class="fas fa-random"></i>
                        </div>
                        <h3 class="text-2xl font-bold mb-3 text-indigo-600">10. 适配器模式 (Adapter)</h3>
                        <p class="text-gray-600 mb-4"><strong>定义：</strong>将一个类的接口转换成客户端期望的另一个接口。</p>
                        <div class="bg-indigo-50 p-4 rounded-lg">
                            <p class="text-indigo-700">
                                <strong>Spring应用：</strong><br>
                                1. HandlerAdapter适配不同类型处理器，使DispatcherServlet能调用它们<br>
                                2. ViewAdapter适配不同视图类型，使DispatcherServlet能渲染不同视图
                            </p>
                        </div>
                    </div>
                </div>

                <!-- 责任链模式 -->
                <div class="pattern-card bg-white rounded-lg overflow-hidden shadow-md transition duration-300">
                    <div class="p-6">
                        <div class="pattern-icon">
                            <i class="fas fa-link"></i>
                        </div>
                        <h3 class="text-2xl font-bold mb-3 text-indigo-600">11. 责任链模式 (Chain of Responsibility)</h3>
                        <p class="text-gray-600 mb-4"><strong>定义：</strong>多个对象都有机会处理请求，避免发送者和接收者间耦合。</p>
                        <div class="bg-indigo-50 p-4 rounded-lg">
                            <p class="text-indigo-700"><strong>Spring应用：</strong>Spring Security使用责任链模式处理一系列安全检查和过滤器。</p>
                        </div>
                    </div>
                </div>

                <!-- 原型模式 -->
                <div class="pattern-card bg-white rounded-lg overflow-hidden shadow-md transition duration-300">
                    <div class="p-6">
                        <div class="pattern-icon">
                            <i class="fas fa-clone"></i>
                        </div>
                        <h3 class="text-2xl font-bold mb-3 text-indigo-600">12. 原型模式 (Prototype)</h3>
                        <p class="text-gray-600 mb-4"><strong>定义：</strong>通过复制现有对象而不是重新创建来生成新实例。</p>
                        <div class="bg-indigo-50 p-4 rounded-lg">
                            <p class="text-indigo-700"><strong>Spring应用：</strong>可以将Bean作用域设置为原型(prototype)，每次请求都创建新实例。</p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Visualization -->
    <section id="visualization" class="py-16 px-4 bg-gray-50">
        <div class="container mx-auto max-w-5xl">
            <h2 class="text-3xl font-bold mb-12 text-center section-title">设计模式在Spring中的关系</h2>
            
            <div class="mermaid-container">
                <div class="mermaid">
                    mindmap
                      root((Spring设计模式))
                        核心模式
                          单例模式:::singleton
                          工厂方法模式:::factory
                          抽象工厂模式:::abstractFactory
                          代理模式:::proxy
                          模板方法模式:::template
                        辅助模式
                          建造者模式:::builder
                          观察者模式:::observer
                          策略模式:::strategy
                          适配器模式:::adapter
                        扩展模式
                          装饰者模式:::decorator
                          责任链模式:::chain
                          原型模式:::prototype
                    
                    classDef singleton fill:#FEE2E2,stroke:#EF4444
                    classDef factory fill:#D1FAE5,stroke:#10B981
                    classDef abstractFactory fill:#DBEAFE,stroke:#3B82F6
                    classDef proxy fill:#EDE9FE,stroke:#8B5CF6
                    classDef template fill:#FEF3C7,stroke:#F59E0B
                    classDef builder fill:#D1D5DB,stroke:#6B7280
                    classDef observer fill:#FCE7F3,stroke:#EC4899
                    classDef strategy fill:#CCFBF1,stroke:#14B8A6
                    classDef adapter fill:#E0E7FF,stroke:#6366F1
                    classDef decorator fill:#F5F5F4,stroke:#78716C
                    classDef chain fill:#ECFDF5,stroke:#10B981
                    classDef prototype fill:#FEF2F2,stroke:#EF4444
                </div>
            </div>

            <div class="grid md:grid-cols-2 gap-8 mt-8">
                <div class="bg-white p-6 rounded-lg shadow-md hover:shadow-lg transition duration-300">
                    <h3 class="text-xl font-semibold mb-4 text-indigo-600">模式分类说明</h3>
                    <ul class="space-y-2">
                        <li class="flex items-start">
                            <span class="inline-block w-4 h-4 bg-red-200 rounded-full mt-1 mr-2"></span>
                            <span><strong>核心模式：</strong>Spring框架基础架构中广泛使用的模式</span>
                        </li>
                        <li class="flex items-start">
                            <span class="inline-block w-4 h-4 bg-blue-200 rounded-full mt-1 mr-2"></span>
                            <span><strong>辅助模式：</strong>支持核心功能实现的关键模式</span>
                        </li>
                        <li class="flex items-start">
                            <span class="inline-block w-4 h-4 bg-green-200 rounded-full mt-1 mr-2"></span>
                            <span><strong>扩展模式：</strong>为特定场景提供灵活性扩展的模式</span>
                        </li>
                    </ul>
                </div>
                <div class="bg-white p-6 rounded-lg shadow-md hover:shadow-lg transition duration-300">
                    <h3 class="text-xl font-semibold mb-4 text-indigo-600">模式应用频率</h3>
                    <div class="space-y-3">
                        <div>
                            <div class="flex justify-between mb-1">
                                <span>单例模式</span>
                                <span>90%</span>
                            </div>
                            <div class="w-full bg-gray-200 rounded-full h-2.5">
                                <div class="bg-red-400 h-2.5 rounded-full" style="width: 90%"></div>
                            </div>
                        </div>
                        <div>
                            <div class="flex justify-between mb-1">
                                <span>代理模式</span>
                                <span>80%</span>
                            </div>
                            <div class="w-full bg-gray-200 rounded-full h-2.5">
                                <div class="bg-purple-400 h-2.5 rounded-full" style="width: 80%"></div>
                            </div>
                        </div>
                        <div>
                            <div class="flex justify-between mb-1">
                                <span>工厂方法</span>
                                <span>75%</span>
                            </div>
                            <div class="w-full bg-gray-200 rounded-full h-2.5">
                                <div class="bg-green-400 h-2.5 rounded-full" style="width: 75%"></div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Key Takeaways -->
    <section class="py-16 px-4">
        <div class="container mx-auto max-w-5xl">
            <div class="bg-indigo-50 rounded-xl p-8 md:p-12">
                <h2 class="text-2xl md:text-3xl font-bold mb-6 text-indigo-700">设计模式在Spring中的关键价值</h2>
                <div class="grid md:grid-cols-2 gap-8">
                    <div>
                        <h3 class="text-xl font-semibold mb-4 text-indigo-600 flex items-center">
                            <i class="fas fa-check-circle mr-2"></i>架构优势
                        </h3>
                        <ul class="space-y-3 text-gray-700">
                            <li class="flex items-start">
                                <i class="fas fa-chevron-right text-indigo-400 mt-1 mr-2 text-xs"></i>
                                <span>通过解耦提高系统灵活性和可维护性</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-chevron-right text-indigo-400 mt-1 mr-2 text-xs"></i>
                                <span>统一的架构风格降低学习曲线</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-chevron-right text-indigo-400 mt-1 mr-2 text-xs"></i>
                                <span>良好的扩展点设计支持功能增强</span>
                            </li>
                        </ul>
                    </div>
                    <div>
                        <h3 class="text-xl font-semibold mb-4 text-indigo-600 flex items-center">
                            <i class="fas fa-lightbulb mr-2"></i>开发启示
                        </h3>
                        <ul class="space-y-3 text-gray-700">
                            <li class="flex items-start">
                                <i class="fas fa-chevron-right text-indigo-400 mt-1 mr-2 text-xs"></i>
                                <span>理解模式有助于深入掌握Spring原理</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-chevron-right text-indigo-400 mt-1 mr-2 text-xs"></i>
                                <span>在自定义扩展时可借鉴类似模式</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-chevron-right text-indigo-400 mt-1 mr-2 text-xs"></i>
                                <span>模式组合使用能解决复杂架构问题</span>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Footer -->
    <footer class="bg-gray-900 text-white py-8 px-4">
        <div class="container mx-auto max-w-5xl">
            <div class="flex flex-col md:flex-row justify-between items-center">
                <div class="mb-4 md:mb-0">
                    <h3 class="text-xl font-bold">技术小馆</h3>
                </div>
                <div>
                    <a href="http://www.yuque.com/jtostring" class="text-gray-300 hover:text-white transition duration-300">
                        <i class="fas fa-link mr-2"></i>http://www.yuque.com/jtostring
                    </a>
                </div>
            </div>
            <div class="border-t border-gray-700 mt-6 pt-6 text-center text-gray-400 text-sm">
                <p>© 2023 技术小馆. 探索技术的艺术.</p>
            </div>
        </div>
    </footer>

    <script>
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            fontSize: 16,
            mindmap: {
                padding: 10
            }
        });
    </script>
</body>
</html>
```